package com.ydw.condition;

import org.springframework.context.annotation.*;

/**
 * @author HYL
 * @create 2017-07-07 上午10:36
 **/
@Configuration
@ComponentScan("com.ydw.condition")
public class ConditionConfig {

    @Bean
    @Conditional(WindowsCondition.class)
    public ConditionService getservice(){
        return new ConditionService("Windows");
    }
    @Bean
    @Conditional(LinuxCondition.class)
    public ConditionService getservice_(){
        return new ConditionService("Linux");
    }
    @Bean
    @Conditional(MacCondition.class)
    public ConditionService _getservice_(){
        return new ConditionService("Mac");
    }


    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConditionConfig.class);
        ConditionService conditionService = context.getBean(ConditionService.class);
        System.out.println(conditionService.getContent());
    }
}
